package com.ruoyi.wms.domain.vo;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

public class MailboxAddressTreeSelectVo implements Serializable {


    private static final long serialVersionUID = 1L;

    /**
     * 节点ID
     */
    private Long id;

    private String code;

    private String name;

    private Long orderNum;

    private String remark;

    private Long parentId;

    private Long level;

    private LocalDateTime createTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Long orderNum) {
        this.orderNum = orderNum;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getLevel() {
        return level;
    }

    public void setLevel(Long level) {
        this.level = level;
    }
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<MailboxAddressTreeSelectVo> children;

    public MailboxAddressTreeSelectVo() {

    }


    public MailboxAddressTreeSelectVo(MailboxAddressVo itemType) {
        this.id = itemType.getId();
        this.parentId = itemType.getParentId();
        this.level = itemType.getLevel();
        this.code = itemType.getCode();
        this.name = itemType.getName();
        this.remark = itemType.getRemark();
        this.orderNum = itemType.getOrderNum();
        this.createTime = itemType.getCreateTime();
        this.children = itemType.getChildren().stream().map(MailboxAddressTreeSelectVo::new).collect(Collectors.toList());
    }
    public List<MailboxAddressTreeSelectVo> getChildren() {
        return children;
    }

    public void setChildren(List<MailboxAddressTreeSelectVo> children) {
        this.children = children;
    }


}
